//
//  SLRACBlueView.m
//  Objective-C
//
//  Created by 陆承东 on 2019/3/6.
//  Copyright © 2019 S_Line. All rights reserved.
//

#import "SLRACBlueView.h"

@interface SLRACBlueView ()

@property (nonatomic, weak) UIButton *button;

@end

@implementation SLRACBlueView

- (instancetype)init {
    self = [super init];
    if (self) {
        [self setupView];
    }
    return self;
}

- (void)setupView {
    [self removeAllSubviews];
    
    self.backgroundColor = [UIColor blueColor];
    
    UIButton *button = [[UIButton alloc] init];
    [button setTitle:@"BlueButton" forState:UIControlStateNormal];
    [button setBackgroundImage:[UIImage imageWithColor:[UIColor orangeColor]] forState:UIControlStateNormal];
    [button setBackgroundImage:[UIImage imageWithColor:[[UIColor orangeColor] colorWithAlphaComponent:0.6]] forState:UIControlStateHighlighted];
    [button addTarget:self action:@selector(blueButtonClick:) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:button];
    
    [button mas_remakeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.mas_centerX).mas_offset(0);
        make.centerY.equalTo(self.mas_centerY).mas_offset(0);
        make.width.mas_equalTo(100);
        make.height.mas_equalTo(36);
    }];
    
}

- (void)blueButtonClick:(UIButton *)sender {
    
}

@end
